{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        <div class="row">
            <div class="col-sm-8">
            <div class="col-sm-6">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>新增会员</h5>
                        <table class="table table-stripped small m-t-md">
                            <tbody>
                            <tr>
                                <td class="no-borders">
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td class="no-borders">
                                    今日会员
                                    <b>
                                        {:db('user')->whereTime('register_datetime','today')->where('reg', 1)->cache(3600)->count()}
                                    </b>
                                    个
                                </td>
                            </tr>
                                <tr>
                                <td class="no-borders">
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td class="no-borders">
                                    昨日会员
                                    <b>
                                        <!-- 统计昨日注册用户 -->
                                        {php}
                                        $todayZeroTime = strtotime(date('Y-m-d 00:00:00'));
                                        $yesterdayZeroTime = $todayZeroTime - 86400;
                                        $yesterdayCount = db('user')
                                        ->whereTime('register_datetime', 'between', [$yesterdayZeroTime, $todayZeroTime])
                                        ->where('reg', 1)
                                        ->cache(3600)
                                        ->count();
                                        {/php}
                                        {:$yesterdayCount}
                                    </b>
                                    个
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    本周会员
                                    <b>
                                        {:db('user')->whereTime('register_datetime','week')->where('reg', 1)->cache(3600)->count()}
                                    </b>
                                    个
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    本月会员
                                    <b>
                                        {:db('user')->whereTime('register_datetime','month')->where('reg', 1)->cache(3600)->count()}
                                    </b>
                                    个
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    总共会员
                                    <b>
                                        {$data.users}
                                    </b>
                                    个
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>敏感行为监听
                            <!-- <a class="pull-right" href="{:url('member/warnRecords')}">查看更多</a> -->
                        </h5>
                        <table class="table table-stripped small m-t-md">
                            <tbody>
                            {volist name='userwarn' id='v'}
                            <tr>
                                <td {eq name='$key' value='0'}class="no-borders"{/eq}>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td {eq name='$key' value='0'}class="no-borders"{/eq}>
                                    用户 <b>{$v.user_id}</b> 操作了：<b><span style="color: red">{$v.desc}</span></b>
                                    <sapn style="float:right">{:date('Y-m-d H:i:s', $v.time)}</sapn>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>会员细分分析</h5>
                        <table class="table table-stripped small m-t-md">
                            <tbody>
                            <tr>
                                <td class="no-borders">
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td class="no-borders">
                                    活跃会员
                                    <b>
                                        {$data.login_user}
                                    </b>
                                    个
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    沉睡会员
                                    <b>
                                        {$data.users - $data.login_user}
                                    </b>
                                    个
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>关于我们</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-hover no-margins">
                            <tbody>
                            <tr>
                                <td style="border-top: 0px;">PHP版本：<span>{:phpversion()}</span></td>
                                <td style="border-top: 0px;">操作系统：<span>{:PHP_OS}</span></td>
                            </tr>
                            <tr>
                                <td>上传限制：<span>{:ini_get('upload_max_filesize')}</span></td>
                                <td>POST限制：<span>{:ini_get('post_max_size')}</span></td>
                            </tr>
                            <tr>
                                <td>更新版本：<span>{:config('version.date')}</span></td>
                                <td>程序版本：<span>{:config('version.release')}</span></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            </div>
            <div class="col-sm-4">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>聊天内容预警</h5>
                        <table class="table table-stripped small m-t-md">
                            <tbody>
                            {volist name='chat' id='v'}
                            <tr>
                                <td {eq name='$key' value='0'}class="no-borders"{/eq}>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td {eq name='$key' value='0'}class="no-borders"{/eq}>
                                    <a onclick="chat('{$v.chat_id}')">
                                    用户 <b>{$v.nickname}</b> 聊天触发：<b><span style="color: red">{$v.title}</span></b>
                                    <sapn style="float:right">{:date('Y-m-d H:i:s', $v.create_time)}</sapn>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

        </div>
        <div class="row">
            {if condition="$tongji"}
            <div class="col-sm-4">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>数据统计</h5>
                        <table class="table table-stripped small m-t-md">
                            <tbody>
                            <tr>
                                <td class="no-borders">
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td class="no-borders">
                                    总流水
                                    <b>
                                        <span style="color: #f00; ">{:number_format($data.platform_balance, 2)}</span>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    活跃人数
                                    <b>
                                        <span style="color: #f00; ">{$data.login_user}</span>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    新增付费人数
                                    <b>
                                        <span style="color: #f00; ">{$data.cost_user}</span>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    新增流水
                                    <b>
                                        <span style="color: #f00; ">{:number_format($data.new_liushui, 2)}</span>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    新增ARPU
                                    <b>
                                        <span style="color: #f00; ">{:number_format($data.new_arpu * 100,2)} %</span>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    新增ARPPU
                                    <b>
                                        <span style="color: #f00; ">{:number_format($data.new_arppu * 100,2)} %</span>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    新增注册
                                    <b>
                                        <span style="color: #f00; ">{$data.new_user}</span>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    新增付费率
                                    <b>
                                        <span style="color: #f00; ">{:number_format($data.new_cost_rate * 100,2)} %</span>
                                    </b>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="ibox">
                    <div class="ibox-content">
                        <h5>用户基本数据</h5>
                        <table class="table table-stripped small m-t-md">
                            <tbody>
                            <tr>
                                <td class="no-borders">
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td class="no-borders">
                                    实名认证
                                    <b>
                                        {$data.auth_user}
                                    </b>
                                    个
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    VIP用户
                                    <b>
                                        {$data.vip_user}
                                    </b>
                                    个
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <i class="fa fa-circle text-navy"></i>
                                </td>
                                <td>
                                    普通用户
                                    <b>
                                        {$data.general_user}
                                    </b>
                                    个
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            {/if}

        </div>

    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
    function chat(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("usertalk/records")}?type=2&search=id&name='+id
            });
        });
    }
</script>